﻿using Algorithms.Expressions;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;
using System.Linq.Expressions;

namespace GeneticAlgorithmTests
{
    [TestClass]
    public class LambdaExpressionTreeEvaluatorTest
    {  
        [TestMethod]
        public void LambdaExpressionTreeEvaluator_Works_On_Simple_Multiplication()
        {
            LambdaExpressionTreeEvaluator target = new LambdaExpressionTreeEvaluator();
            Expression tree = Expression.Multiply(ExpressionFactoryContainer.DefaultInputParameterExpression, Expression.Constant(2d));
            double input = 2; 
            double expected = 4; 
            double actual;
            actual = target.Evaluate(tree, input);
            Assert.AreEqual(expected, actual);
        }
    }
}
